Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-134: Fixed issue with LOADPICT if it's called before other turtle commands #135

Merged
merged 1 commit into from
Jun 28, 2022

Conversation

dmalec
Copy link
Collaborator

@dmalec dmalec commented Jun 25, 2022

resolves #134

Summary

It looks like the crux of this bug is that the LOADPICT command doesn't call the turtle setup code before loading the graphics file. After adding that block, the code behaves as expected:
Screen Shot 2022-06-25 at 2 33 25 PM

Additional Changes

I noticed this issue while working on cleaning up some of the warning messages for issue #20 :

graphics.c: In function ‘restore_palette’:
graphics.c:1196:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
     fread(&nslots, sizeof(int), 1, fp);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c:1199:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread(colors, sizeof(int), 3, fp);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c: In function ‘lloadpict’:
graphics.c:2092:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread(&rec_idx, sizeof(FIXNUM), 1, fp);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c:2099:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  (void)fread(&next, One, 1, fp);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c:2130:6: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
      (void)fread(&next, One, 1, fp);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
graphics.c:2148:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread(&bg, sizeof(int), 1, fp);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I've included the warning message cleanup specific to this method in this PR; but, I can also split them out into a separate PR if that makes it easier to review.

Test Environment

  • OSX Catalina (10.15.7) w/ wxWidgets 3.0.5
  • Ubuntu Bionic (18.04.5) w/ wxWidgets 3.0.5

  • Windows 10 Pro (19043.1766) w/ wxWidgets 3.0.5

…le commands

* LOADPICT now sets up turtle graphics if needed
* added checking of results from fread to prevent warnings during build
Copy link
Owner

@jrincayc jrincayc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and approved.

@jrincayc jrincayc merged commit ad2aafd into jrincayc:master Jun 28, 2022
@jrincayc
Copy link
Owner

Thank you for fixing this and issue 50 :)

@dmalec
Copy link
Collaborator Author

dmalec commented Jun 28, 2022

You're welcome, no worries :)

@dmalec dmalec deleted the ISSUE-134 branch January 18, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If LOADPICT is run before other turtle graphics commands, nothing is drawn
2 participants